]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Refactor code resetting IM on window drags
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 3 Aug 2018 14:01:48 +0000 (16:01 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Fri, 3 Aug 2018 15:02:20 +0000 (17:02 +0200)
When a window is dragged, the OSK should get hidden. Just
do this in a nicer way.

js/ui/keyboard.js

index 4a249404450f8cd7c7f894ef3427bc5201b94f3b..5d5f0e2c6f56d38f53fda9d717613d88199ac7ef 100644 (file)
@@ -492,13 +492,18 @@ var FocusTracker = new Lang.Class({
 
     _init() {
         this._currentWindow = null;
-        this._currentWindowPositionId = 0;
 
         global.display.connect('notify::focus-window', () => {
             this._setCurrentWindow(global.display.focus_window);
             this.emit('window-changed', this._currentWindow);
         });
 
+        global.display.connect('grab-op-begin', (display, window, op) => {
+            if (window == this._currentWindow &&
+                (op == Meta.GrabOp.MOVING || op == Meta.GrabOp.KEYBOARD_MOVING))
+                this.emit('reset');
+        });
+
         /* Valid for wayland clients */
         Main.inputMethod.connect('cursor-location-changed', (o, rect) => {
             let newRect = { x: rect.get_x(), y: rect.get_y(), width: rect.get_width(), height: rect.get_height() };
@@ -520,16 +525,7 @@ var FocusTracker = new Lang.Class({
     },
 
     _setCurrentWindow(window) {
-        if (this._currentWindow)
-            this._currentWindow.disconnect(this._currentWindowPositionId);
-
         this._currentWindow = window;
-        if (window) {
-            this._currentWindowPositionId = this._currentWindow.connect('position-changed', () => {
-                if (global.display.get_grab_op() != Meta.GrabOp.NONE)
-                    this.emit('reset');
-            });
-        }
     },
 
     _setCurrentRect(rect) {